package com.example.demo.demos;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.io.Resource;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.io.File;


public class MyCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String resourcePath = "test.properties";
        Resource file = context.getResourceLoader().getResource(resourcePath);
        return file.exists();
    }
}
